package wodegua.d14_arrays;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.function.IntToDoubleFunction;

public class Test {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        System.out.println(Arrays.toString(arr));

        int[] arr1 = Arrays.copyOfRange(arr, 1, 4);
        System.out.println(Arrays.toString(arr1));

        int[] arr2 = Arrays.copyOf(arr, 10);
        System.out.println(Arrays.toString(arr2));

        double[] arr3 = {70, 80, 90, 100};
        Arrays.setAll(arr3, new IntToDoubleFunction(){
            @Override
            public double applyAsDouble(int value) {
                return BigDecimal.valueOf(arr3[value]).multiply(BigDecimal.valueOf(0.8)).doubleValue();
            }
        });
        System.out.println(Arrays.toString(arr3));

    }
}
